package com.lw;

import java.awt.*;

/**
 * 难度选择
 */
public class GameSelect {

    /**
     * 判断鼠标点击了哪个按钮
     * X轴都是相同的，按钮起点 (100,50),终点(100+300,50)
     * Y轴是不同的，
     *      简单按钮(100,50)->(100,50+100)
 *          普通按钮(100,200)->(100,200+100)
 *          困难按钮(100,350)->(100,350+100)
     * @return
     */
    boolean clickButton(){
        if(GameUtil.MOUSE_X>100&&GameUtil.MOUSE_X<400){
            if(GameUtil.MOUSE_Y>50&&GameUtil.MOUSE_Y<150){
                GameUtil.level = 1;
                GameUtil.state = 0;
                return true;
            }else  if(GameUtil.MOUSE_Y>200&&GameUtil.MOUSE_Y<300){
                GameUtil.level = 2;
                GameUtil.state = 0;
                return true;
            }else  if(GameUtil.MOUSE_Y>350&&GameUtil.MOUSE_Y<450){
                GameUtil.level = 3;
                GameUtil.state = 0;
                return true;
            }
        }
        return false;
    }

    void clickButton(int level){
        switch (level){
            case 1-> {
                GameUtil.RAY_MAX = 10;
                GameUtil.MAP_W = 9;
                GameUtil.MAP_H = 9;
            }
            case 2-> {
                GameUtil.RAY_MAX = 40;
                GameUtil.MAP_W = 16;
                GameUtil.MAP_H = 16;
            }
            case 3-> {
                GameUtil.RAY_MAX = 99;
                GameUtil.MAP_W = 30;
                GameUtil.MAP_H = 16;
            }
        }
    }

    void paintSelf(Graphics g){
        g.setColor(Color.BLACK);

        g.drawRect(100,50,300,100);
        GameUtil.drawWord(g,"简单",220,100,30,Color.black);

        g.drawRect(100,200,300,100);
        GameUtil.drawWord(g,"普通",220,250,30,Color.black);

        g.drawRect(100,350,300,100);
        GameUtil.drawWord(g,"困难",220,400,30,Color.black);


    }
}
